﻿using IBLL;
using IDAL;
using Model;

namespace BLL
{
    public class rkbll:IRKBLL
    {
        public rkbll(IRKDAL<YHmdel> dal)
        {
            Dal = dal;
        }

        public IRKDAL<YHmdel> Dal { get; }

        public Task<int> Add(YHmdel y)
        {
           return Dal.AddAsync(y);
        }

        public Task<int> Delete(int id)
        {
            var res = Dal.GetAll().FirstOrDefault(p=>p.Yid == id);
            return Dal.DeleteAsync(res);
        }

        public dynamic Show()
        {
            return Dal.GetAll();
        }

        public Task<int> Update(YHmdel y)
        {
            return Dal.UpdateAsync(y);
        }
    }
}
